package cn.zonhar.controller;

import cn.zonhar.common.core.R;
import cn.zonhar.entities.bean.UserBean;
import cn.zonhar.service.LoginService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpRequest;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * 健康160登陆
 */
@RestController
@RequestMapping("/health")
public class LoginController {

    @Autowired
    private LoginService loginService;

    @PostMapping("/login")
    public R healthLogin(HttpServletResponse response, @RequestBody UserBean userBean){
        String token =loginService.login(response,userBean);
        return R.ok().put("data",token);
    }

}
